// Copyright 2007 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package lichen.hibernate;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.hibernate.Filter;
import org.hibernate.Interceptor;
import org.hibernate.LockMode;
import org.hibernate.ReplicationMode;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.support.SQLExceptionTranslator;
import org.springframework.orm.hibernate3.HibernateCallback;



/**
 * 针对实体类的处理，需要加上事物的控制.
 * @author jcai
 * @version $Revision: 161 $
 * @since 0.0.3
 */
public interface EntityService {

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#bulkUpdate(java.lang.String,
	 *      java.lang.Object)
	 */
	
	public int bulkUpdate(String queryString, Object value) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#bulkUpdate(java.lang.String,
	 *      java.lang.Object[])
	 */
	
	public int bulkUpdate(String queryString, Object[] values) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#bulkUpdate(java.lang.String)
	 */
	
	public int bulkUpdate(String queryString) throws DataAccessException;

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#clear()
	 */
	public void clear() throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#closeIterator(java.util.Iterator)
	 */
	public void closeIterator(Iterator it) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#contains(java.lang.Object)
	 */
	public boolean contains(Object entity) throws DataAccessException;

	
	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#delete(java.lang.Object,
	 *      org.hibernate.LockMode)
	 */
	
	public void delete(Object entity, LockMode lockMode) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#delete(java.lang.Object)
	 */
	
	public void delete(Object entity) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#deleteAll(java.util.Collection)
	 */
	
	public void deleteAll(Collection entities) throws DataAccessException;

	/**
	 * 
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#enableFilter(java.lang.String)
	 */
	public Filter enableFilter(String filterName) throws IllegalStateException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#evict(java.lang.Object)
	 */
	public void evict(Object entity) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#execute(org.springframework.orm.hibernate3.HibernateCallback,
	 *      boolean)
	 */
	public Object execute(HibernateCallback action, boolean exposeNativeSession) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#execute(org.springframework.orm.hibernate3.HibernateCallback)
	 */
	public Object execute(HibernateCallback action) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#executeFind(org.springframework.orm.hibernate3.HibernateCallback)
	 */
	public List executeFind(HibernateCallback action) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#find(java.lang.String,
	 *      java.lang.Object)
	 */
	public List find(String queryString, Object value) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#find(java.lang.String,
	 *      java.lang.Object[])
	 */
	public List find(String queryString, Object[] values) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#find(java.lang.String)
	 */
	public List find(String queryString) throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByCriteria(org.hibernate.criterion.DetachedCriteria,
	 *      int, int)
	 */
	public List findByCriteria(DetachedCriteria criteria, int firstResult, int maxResults) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByCriteria(org.hibernate.criterion.DetachedCriteria)
	 */
	public List findByCriteria(DetachedCriteria criteria) throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByExample(java.lang.Object,
	 *      int, int)
	 */
	public List findByExample(Object exampleEntity, int firstResult, int maxResults) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByExample(java.lang.Object)
	 */
	public List findByExample(Object exampleEntity) throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedParam(java.lang.String,
	 *      java.lang.String, java.lang.Object)
	 */
	public List findByNamedParam(String queryString, String paramName, Object value) throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedParam(java.lang.String,
	 *      java.lang.String[], java.lang.Object[])
	 */
	public List findByNamedParam(String queryString, String[] paramNames, Object[] values) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedQuery(java.lang.String,
	 *      java.lang.Object)
	 */
	public List findByNamedQuery(String queryName, Object value) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedQuery(java.lang.String,
	 *      java.lang.Object[])
	 */
	public List findByNamedQuery(String queryName, Object[] values) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedQuery(java.lang.String)
	 */
	public List findByNamedQuery(String queryName) throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedQueryAndNamedParam(java.lang.String,
	 *      java.lang.String, java.lang.Object)
	 */
	public List findByNamedQueryAndNamedParam(String queryName, String paramName, Object value) throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedQueryAndNamedParam(java.lang.String,
	 *      java.lang.String[], java.lang.Object[])
	 */
	public List findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object[] values) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByNamedQueryAndValueBean(java.lang.String,
	 *      java.lang.Object)
	 */
	public List findByNamedQueryAndValueBean(String queryName, Object valueBean) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#findByValueBean(java.lang.String,
	 *      java.lang.Object)
	 */
	public List findByValueBean(String queryString, Object valueBean) throws DataAccessException;

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#flush()
	 */
	public void flush() throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#get(java.lang.Class,
	 *      java.io.Serializable, org.hibernate.LockMode)
	 */
	public Object get(Class entityClass, Serializable id, LockMode lockMode) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#get(java.lang.Class,
	 *      java.io.Serializable)
	 */
	public Object get(Class entityClass, Serializable id) throws DataAccessException;

	/**
	
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#get(java.lang.String,
	 *      java.io.Serializable, org.hibernate.LockMode)
	 */
	public Object get(String entityName, Serializable id, LockMode lockMode) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#get(java.lang.String,
	 *      java.io.Serializable)
	 */
	public Object get(String entityName, Serializable id) throws DataAccessException;

	/**
	 * 
	 * 
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#getEntityInterceptor()
	 */
	public Interceptor getEntityInterceptor() throws IllegalStateException, BeansException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#getFetchSize()
	 */
	public int getFetchSize();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#getFilterNames()
	 */
	public String[] getFilterNames();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#getFlushMode()
	 */
	public int getFlushMode();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#getJdbcExceptionTranslator()
	 */
	public SQLExceptionTranslator getJdbcExceptionTranslator();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#getMaxResults()
	 */
	public int getMaxResults();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#getQueryCacheRegion()
	 */
	public String getQueryCacheRegion();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#getSessionFactory()
	 */
	public SessionFactory getSessionFactory();

	/**
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#initialize(java.lang.Object)
	 */
	public void initialize(Object proxy) throws DataAccessException;

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#isAllowCreate()
	 */
	public boolean isAllowCreate();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#isAlwaysUseNewSession()
	 */
	public boolean isAlwaysUseNewSession();

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#isCacheQueries()
	 */
	public boolean isCacheQueries();

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#isCheckWriteOperations()
	 */
	public boolean isCheckWriteOperations();

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#isExposeNativeSession()
	 */
	public boolean isExposeNativeSession();

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#iterate(java.lang.String,
	 *      java.lang.Object)
	 */
	public Iterator iterate(String queryString, Object value) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#iterate(java.lang.String,
	 *      java.lang.Object[])
	 */
	public Iterator iterate(String queryString, Object[] values) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#iterate(java.lang.String)
	 */
	public Iterator iterate(String queryString) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#load(java.lang.Class,
	 *      java.io.Serializable, org.hibernate.LockMode)
	 */
	public Object load(Class entityClass, Serializable id, LockMode lockMode) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#load(java.lang.Class,
	 *      java.io.Serializable)
	 */
	public Object load(Class entityClass, Serializable id) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#load(java.lang.Object,
	 *      java.io.Serializable)
	 */
	public void load(Object entity, Serializable id) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#load(java.lang.String,
	 *      java.io.Serializable, org.hibernate.LockMode)
	 */
	public Object load(String entityName, Serializable id, LockMode lockMode) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#load(java.lang.String,
	 *      java.io.Serializable)
	 */
	public Object load(String entityName, Serializable id) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#loadAll(java.lang.Class)
	 */
	public List loadAll(Class entityClass) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#lock(java.lang.Object,
	 *      org.hibernate.LockMode)
	 */
	public void lock(Object entity, LockMode lockMode) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#lock(java.lang.String,
	 *      java.lang.Object, org.hibernate.LockMode)
	 */
	public void lock(String entityName, Object entity, LockMode lockMode) throws DataAccessException;

	/**
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#merge(java.lang.Object)
	 */
	public Object merge(Object entity) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#merge(java.lang.String,
	 *      java.lang.Object)
	 */
	public Object merge(String entityName, Object entity) throws DataAccessException;

	/**
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#persist(java.lang.Object)
	 */
	public void persist(Object entity) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#persist(java.lang.String,
	 *      java.lang.Object)
	 */
	public void persist(String entityName, Object entity) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#refresh(java.lang.Object,
	 *      org.hibernate.LockMode)
	 */
	public void refresh(Object entity, LockMode lockMode) throws DataAccessException;

	/**
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#refresh(java.lang.Object)
	 */
	public void refresh(Object entity) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#replicate(java.lang.Object,
	 *      org.hibernate.ReplicationMode)
	 */
	public void replicate(Object entity, ReplicationMode replicationMode) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#replicate(java.lang.String,
	 *      java.lang.Object, org.hibernate.ReplicationMode)
	 */
	public void replicate(String entityName, Object entity, ReplicationMode replicationMode) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#save(java.lang.Object)
	 */
	
	public Serializable save(Object entity) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#save(java.lang.String,
	 *      java.lang.Object)
	 */
	
	public Serializable save(String entityName, Object entity) throws DataAccessException;

	/**
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#saveOrUpdate(java.lang.Object)
	 */
	
	public void saveOrUpdate(Object entity) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#saveOrUpdate(java.lang.String,
	 *      java.lang.Object)
	 */
	
	public void saveOrUpdate(String entityName, Object entity) throws DataAccessException;

	/**
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#saveOrUpdateAll(java.util.Collection)
	 */
	
	public void saveOrUpdateAll(Collection entities) throws DataAccessException;

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setAllowCreate(boolean)
	 */
	public void setAllowCreate(boolean allowCreate);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setAlwaysUseNewSession(boolean)
	 */
	public void setAlwaysUseNewSession(boolean alwaysUseNewSession);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setBeanFactory(org.springframework.beans.factory.BeanFactory)
	 */
	public void setBeanFactory(BeanFactory beanFactory);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setCacheQueries(boolean)
	 */
	public void setCacheQueries(boolean cacheQueries);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setCheckWriteOperations(boolean)
	 */
	public void setCheckWriteOperations(boolean checkWriteOperations);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setEntityInterceptor(org.hibernate.Interceptor)
	 */
	public void setEntityInterceptor(Interceptor entityInterceptor);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setEntityInterceptorBeanName(java.lang.String)
	 */
	public void setEntityInterceptorBeanName(String entityInterceptorBeanName);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setExposeNativeSession(boolean)
	 */
	public void setExposeNativeSession(boolean exposeNativeSession);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setFetchSize(int)
	 */
	public void setFetchSize(int fetchSize);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setFilterName(java.lang.String)
	 */
	public void setFilterName(String filter);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setFilterNames(java.lang.String[])
	 */
	public void setFilterNames(String[] filterNames);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setFlushMode(int)
	 */
	public void setFlushMode(int flushMode);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setFlushModeName(java.lang.String)
	 */
	public void setFlushModeName(String constantName);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setJdbcExceptionTranslator(org.springframework.jdbc.support.SQLExceptionTranslator)
	 */
	public void setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setMaxResults(int)
	 */
	public void setMaxResults(int maxResults);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#setQueryCacheRegion(java.lang.String)
	 */
	public void setQueryCacheRegion(String queryCacheRegion);

	/**
	
	 * @see org.springframework.orm.hibernate3.HibernateAccessor#setSessionFactory(org.hibernate.SessionFactory)
	 */
	public void setSessionFactory(SessionFactory sessionFactory);

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#update(java.lang.Object,
	 *      org.hibernate.LockMode)
	 */
	
	public void update(Object entity, LockMode lockMode) throws DataAccessException;

	/**
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#update(java.lang.Object)
	 */
	
	public void update(Object entity) throws DataAccessException;

	/**
	
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#update(java.lang.String,
	 *      java.lang.Object, org.hibernate.LockMode)
	 */
	
	public void update(String entityName, Object entity, LockMode lockMode) throws DataAccessException;

	/**
	
	
	
	 * @see org.springframework.orm.hibernate3.HibernateTemplate#update(java.lang.String,
	 *      java.lang.Object)
	 */
	
	public void update(String entityName, Object entity) throws DataAccessException;

	
}
